# Replication Package for "In the Name of Love: Policy Imitation, Political Incentives, and Local Economic Growth"

This repository contains the replication materials for the paper **"In the Name of Love: Policy Imitation, Political Incentives, and Local Economic Growth"**.

## Authors

*   **Hai Hong** - China Academy for Rural Development (CARD), Zhejiang University
*   **Yunfei Zhang** - Jiaxing University
*   **Kevin Chen** - China Academy for Rural Development (CARD), Zhejiang University; International Food Policy Research Institute, China

---

## Overview

The code and data in this package allow for the replication of the tables and figures presented in the main text and appendix of the article. The analysis relies on **Stata** for the main estimation and **R** for the visualization of some figures.

## Software Requirements

*   **Stata**: The analysis was performed using Stata (e.g., version 19). Required user-written packages may need to be installed (e.g., `reghdfe`, `estout`, etc.).
*   **R**: Used for generating high-quality visualizations using `ggplot2`.
    *   Key packages: `tidyverse`, `fixest`, `showtext`, `vtable`, `writexl`, `haven`, `gridExtra`.

## File Structure

The replication package is organized as follows:

### 1. `dofile/`
This folder contains the code to replicate the figures and tables.
*   `Tables_MainText.do`: Generates the tables for the main text.
*   `Tables_Appendix.do`: Generates the tables for the appendix.
*   `Figure*.R` / `Figure*.do`: Scripts to generate specific figures. Files ending in `.do` perform calculations or Stata plotting, while `.R` files use `ggplot2` for final visualization.

### 2. `workdata/`
This folder contains the necessary datasets for the analysis.
*   `township_panel_final.dta`: Main panel dataset.
*   `village_panel_final.dta`: Village-level data.
*   `*.csv`: Processed data files used by R scripts to generate figures (e.g., `event_study.csv`, `feature_high_kw.csv`, etc.).

### 3. `figure/` & `table/`
Destination folders for the output figures and tables.

---

## Replication Instructions

### Step 1: Directory Setup
Before running any code, you must set the root directory to match your local file path.
1.  Open the Stata do-files (e.g., `Tables_MainText.do`).
2.  Locate the line defining the global root path:
    ```stata
    global root = "D:\WorkingPaper-Series\Township_Light\Replication_Files"
    ```
    Change this path to the location where you extracted this package.
3.  Similarly, check the `.R` files (e.g., `setwd(...)`) and update the path to the `workdata` folder if necessary.

### Step 2: Reproducing Tables
Run `dofile/Tables_MainText.do` and `dofile/Tables_Appendix.do` to reproduce the regression results and estimates found in the paper.

### Step 3: Reproducing Figures (Important Note)
The figures in this paper are primarily generated using **R (`ggplot2`)** based on estimation results exported from Stata.

*   **Data Process**: The plotting data (`.csv` files in `workdata/`) was originally generated by Stata. However, to make them compatible with `ggplot2` for publication-quality graphs, these CSV files underwent manual processing (e.g., adding variable labels, merging distinct output files) after being exported from Stata.
*   **Replication vs. Visualization**: 
    *   **To check the empirical results**: You can run the corresponding Stata code. This will produce the numerical estimates consistent with the paper.
    *   **To reproduce the exact figures**: You can run the provided `.R` scripts. These scripts read the pre-processed CSV files located in the `workdata/` directory.

---

## Data Availability Statement
The datasets provided in `workdata/` are sufficient to replicate the analysis reported in the paper.
